package com.lxh.empwork.web.servlet;

import com.alibaba.fastjson.JSON;
import com.lxh.empwork.entity.Dept;
import com.lxh.empwork.services.DeptServices;
import com.lxh.empwork.services.impl.DeptServicesImpl;

import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * @author: COS
 * @time: 2022/9/23 17:17
 * @description:
 */
@WebServlet("/dept")
public class DeptController extends BaseServlet {
    private DeptServices ds = new DeptServicesImpl();

    public String getAll(HttpServletRequest request, HttpServletResponse response) {
        List<Dept> all = ds.getAll();
        String jsonString = JSON.toJSONString(all);
        return jsonString;
    }

}
